package bjut.zrpc.core.optimization.loadbalance;


import bjut.zrpc.core.optimization.factory.SingletonFactory;
import bjut.zrpc.core.optimization.message.ZRpcRequestMessage;

import java.util.List;
import java.util.Random;

/**
 * @Author: zhuzhiming
 * @Date: 2022/6/24 19:59
 */
public class RandomLoadBalance extends AbstractLoadBalance {


    @Override
    public String doSelect(List<String> serviceList, ZRpcRequestMessage zRpcRequestMessage) {

        Random random = new Random();
        return serviceList.get(random.nextInt(serviceList.size()));
    }
}
